#include <iostream>
#include <cmath>

using namespace std;
int sum;
double ret = 0;
int main()
{
	int n,m;
	cin >> n >> m;
	int max1 = 0;
	int t;
	int min1 = 20;
	int tmp = n;
	while(tmp--)
	{
		max1=0;
		min1=20;
		sum=0;
		for(int i = 0;i<m;i++)
		{
			cin >> t;
			if(t>max1)
			max1=t;
			if(t<min1)
			min1 = t;
			sum+=t;
		}
		double r = (sum-max1-min1)*1.0/(m-2);
		ret = max(ret,r);
	}
	printf("%.2f",ret);
}
